package zs.com.wework;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;

import java.util.ArrayList;
import java.util.List;

/**
 * ClassName:ContactPage
 * Package:zs.com.wework
 * Description:此处编写类描述内容
 * Date:2021/11/24 20:24
 * Author:zs
 */
public class ContactPage extends BasePage{
    public ContactPage(WebDriver driver) {
        super(driver);
    }

    public ContactPage addMember(String name, String account, String mobile) {
        driver.findElement(By.linkText("添加成员")).click();
        driver.findElement(By.name("username")).sendKeys(name);
        driver.findElement(By.name("acctid")).sendKeys(account);
        driver.findElement(By.name("mobile")).sendKeys(mobile);
        driver.findElement(By.linkText("保存")).click();
        return this;
    }

    public List<String> getCurrMemberList() {
        ArrayList<String> lMember = new ArrayList<>();
        //$("#member_list > tr > td:nth-child(2)>span")
        driver.findElements(By.cssSelector("#member_list > tr > td:nth-child(2)>span")).forEach(e->{
            lMember.add(e.getText());
        });
        return lMember;
    }
}
